package com.avengers.core.bean.enums;

/**
 * @author yu.wang
 * @since 2018-08-15 上午11:07
 */
public enum CommonStatus {
    // YES
    YES(1),
    // NO
    NO(0);

    public final boolean booleanValue;
    public final Integer intValue;
    public final String value;

    CommonStatus(int intValue) {
        this.booleanValue = 1 == intValue;
        this.intValue = intValue;
        this.value = name();
    }

    public static CommonStatus fromValue(Integer intValue) {
        for (CommonStatus status : values()) {
            if (status.intValue.equals(intValue)) {
                return status;
            }
        }
        return null;
    }
}
